Skip to content

fix(types): type INFORMATION_SCHEMA.TABLES.creation_time as TIMESTAMP (#9) - #15

Draft
expobrain wants to merge 1 commit into
stack/03-numeric-paramsfrom
stack/04-creation-time-timestamp
Draft

expobrain wants to merge 1 commit into
stack/03-numeric-paramsfrom
stack/04-creation-time-timestamp

Conversation

@expobrain

Copy link
Copy Markdown
Owner

What

INFORMATION_SCHEMA.TABLES.creation_time is declared as STRING in googlesqlite, so the emulator reported a string column and comparisons such as creation_time > TIMESTAMP('2020-01-01') failed with a type error.

The query is now rewritten to cast creation_time to TIMESTAMP wherever it is read from INFORMATION_SCHEMA.TABLES. This fixes both the reported result schema and typed comparisons. Ownership: the underlying schema lives in googlesqlite (internal/info_schema.go); until it is corrected upstream, the emulator applies the cast at query rewrite time.

Changes

  • internal/contentdata/repository.go: query rewrite for creation_time in INFORMATION_SCHEMA.TABLES queries.
  • server/server_test.go: TestInformationSchemaTablesCreationTimeIsTimestamp asserts the TIMESTAMP schema type and a successful comparison query returning rows.

Verification

  • go test ./server ./internal/... ./types — all green.

Stack

Rung 4, based on stack/03-numeric-params (PR #14). Next: #11 (CREATE SNAPSHOT TABLE).

Refs #9

…#9)

googlesqlite models creation_time as a STRING column. Cast it to TIMESTAMP when a query reads it from INFORMATION_SCHEMA.TABLES, which fixes both the reported column type and comparisons against timestamp literals. Ownership note: the underlying schema lives in googlesqlite; until it is fixed upstream, the emulator applies the cast at query rewrite time.

Refs #9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant